package dn.controller;

import dn.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("/param")
public class ParamReceiveController {

    @RequestMapping("/p1")
    public @ResponseBody String p1(Integer id,String name){
        System.out.println(id);
        System.out.println(name);
        return "p1";
    }

    @RequestMapping(value = "/p2/{id}")
    @ResponseBody
    public String p2(@PathVariable Integer id){
        System.out.println(id);
        return "p2";
    }

    @RequestMapping(value = "/p3")
    @ResponseBody
    public User p3(){
        User user = new User("杨通通",28,"山东");
        user.setId(12);
        return user;
    }

    @RequestMapping(value = "/p4",method = RequestMethod.POST)
    @ResponseBody
    public User p4(@RequestBody User user){

        return user;

    }
}
